<template>
  <div class="order-header">
    <div class="order-headerContain ">
      <div class="header-logo">
        <a href="/#/index"></a>
      </div>
      <div class="title">
        <h2>{{title}}
          <slot name='tip'></slot>
        </h2>
      </div>
      <div class="username">
        <a href="javascript:;">{{username}}</a>
      </div>
    </div>
  </div>
</template>

<script>
  import {mapState} from 'vuex'

  export default {
    name: 'order-header',
    props: {
      title: String
    },
    computed: {
      ...mapState(['username', 'cartCount'])
    }
  }
</script>

<style lang="scss">
@import './../assets/scss/mixin.scss';

  .order-headerContain {
    padding: 0 12%;

  }
  .order-header {
    height: 55px;
    padding: 30px 0;
    border-bottom: 2px solid #FF6600;



    .header-logo {
      float: left;
      a{
        display: inline-block;
        width: 110px;
        height: 55px;
        // 等价 a:before，这里是scss的写法
        &:before{
          content: ' ';  // 一定要加用来占位，不加伪类就没了-->
          @include bgImg(55px,55px,'../assets/imgs/logo2.png',55px);
          // 配合鼠标悬停:hover，对margin属性实现过渡动画0.2秒完成-->
          transition: margin 0.2s;
        }
        :after{
          content: ' ';
          @include bgImg(55px,55px,'../assets/imgs/logo2.png',55px);
        }
        // 将伪类:before设置鼠标悬停向左移动55px
        :hover:before{
          margin-left: -55px;
        }
      }
    }

    .title, .username {
      display: inline-block;
      height: 55px;
      line-height: 55px;
    }

    .title {
      float: left;
      margin-left: 54px;

      h2 {
        font-size: 28px;
        color: #333333;
      }

      span {
        font-size: 14px;
        margin-left: 17px;
        color: #999999;
        font-weight: 200;
      }
    }

    .username {
      float: right;

      a {
        color: #666666;
        font-size: 16px;
      }
    }
  }
</style>
